package com;

/**
 * 功能或描述：
 * package com
 *
 * @author DR.YangLong
 *         date 14-10-14
 *         time 上午11:31
 *         email 410357434@163.com
 * @version 1.0
 * @since 1.0
 * module 修正:            日期：
 */
public class BaseTypeTest {
    private String changeValue="nochange";

    public String getChangeValue() {
        return changeValue;
    }

    public void setChangeValue(String changeValue) {
        this.changeValue = changeValue;
    }

    public static void print(int b){
        b=5;
        System.out.println(b);
    }

    public static void print(String s){
        String[] strings={"username","password"};
        s=strings[0];
        System.out.println(s);
    }

    public void nochange(BaseTypeTest baseTypeTest){
        System.out.println(baseTypeTest.toString());
        baseTypeTest=new BaseTypeTest();
        baseTypeTest.setChangeValue("change?");
    }
    public void change(BaseTypeTest baseTypeTest){
        System.out.println(baseTypeTest.toString());
        baseTypeTest.setChangeValue("change!");
    }

    public static void main(String[] args){
        BaseTypeTest baseTypeTest=new BaseTypeTest();
        int a=10;
        String b="password";
        print(a);
        System.out.println("基本数据类型main中值没变化，值传递"+a);
        print(b);
        System.out.println("引用数据类型main中值没变化，无法改变引用地址，传递的是引用地址的值"+b);
        baseTypeTest.nochange(baseTypeTest);
        System.out.println("引用类型，重新赋值，没有改变"+baseTypeTest.getChangeValue());
        baseTypeTest.change(baseTypeTest);
        System.out.println("引用类型，改变了引用地址对应对象的内容，main中对象内容改变"+baseTypeTest.getChangeValue());
    }
}
